/*
 * To change this template, choose Tools | Templates and open the template in
 * the editor.
 */
package cn.eclass.bean;

import cn.eclass.bean.api.IGiftBean;
import cn.eclass.dao.GiftDao;
import cn.eclass.entity.GiftEntity;
import cn.eclass.entity.UserEntity;
import cn.eclass.utils.BeanFactory;

import java.util.List;

/**
 *
 * @author fortruth
 */
public class GiftBean implements IGiftBean {

    GiftDao dao = new GiftDao();

    @Override
    public GiftEntity add(GiftEntity entity) {
        int newId = dao.add(entity);
        entity.setId(newId);
        return entity;
    }

    @Override
    public boolean update(GiftEntity entity) {
        return dao.update(entity);
    }

    @Override
    public boolean delete(int id) {
        return dao.delete(id);
    }

    @Override
    public GiftEntity get(int id) {
        return dao.get(id);
    }

    @Override
    public List<GiftEntity> list() {
        return dao.list();
    }
    
    @Override
    public List<GiftEntity> getGiftByCat(int catId) {
    	return dao.getByCat(catId);
    }
}
